//
//  CategoryDownViewCell.m
//  futureLive
//
//  Created by iOS on 15/11/18.
//  Copyright © 2015年 ZHOU_LI_SUN. All rights reserved.
//

#import "CategoryDownViewCell.h"
#import <UIImageView+WebCache.h>

@interface CategoryDownViewCell ()

@property (nonatomic, strong) UIImageView *imageView;

@end
@implementation CategoryDownViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupSubViews];
    }
    return self;
}

-(void)setupSubViews{
    
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, self.frame.size.width - 10, 80)];
    self.imageView.backgroundColor = [UIColor yellowColor];
    
    [self.contentView addSubview:self.imageView];
    
}
-(void)setCategoryModel:(CategoryModel *)categoryModel{
    if (_categoryModel != categoryModel) {
        _categoryModel = nil;
        _categoryModel = categoryModel;
        
        
        [self layoutModel];
    }
    
}

-(void)layoutModel{
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:_categoryModel.img]];
    
    
    
}

-(void)prepareForReuse{
    [super prepareForReuse];
}
//cell 属性
-(UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    
    self.imageView.frame = CGRectMake(10, 10, self.frame.size.width - 20, self.frame.size.height - 30);
    
    
    return layoutAttributes;
    
}








@end
